import React, { useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useContext } from 'react';
import { useRouter } from 'next/router';
import { Tree, Radio, Space, Input, Tabs, } from 'antd';
import { WorkbenchesContext, } from '@/components/workbenches/workbenches-context';
import InDetailModel from './inDetail'
import {
  ComponentType,
} from '@/components/workbenches/hooks/type';

const dataTree = () => {
  const { t, i18n } = useTranslation();
  const router = useRouter();
  const [open, setOpen] = useState(false)
  const {
    currentItem,
  } = useContext(WorkbenchesContext);
  useEffect(() => {
    if (currentItem && currentItem.type === 'table') {
      setOpen(true)
    }
  }, [currentItem.key])
  return (
    <>
      <div style={{ width: '97%', margin: '0 auto' }}>
        {<InDetailModel open={open} modelType={'table'} currentItem={currentItem} measurementValue={0} onClose={() => {
          setOpen(false);
        }} />}
      </div>
    </>
  );
}

export default dataTree;
